package com.wlc.exception.demo03;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 测试支票
 * @date 2021-07-08 16:42
 */
public class TestCheckingAccount {

    public void method01(){
        CheckingAccount checkingAccount = new CheckingAccount(500,200);
        // 余额
        double balance = checkingAccount.getBalance();
        try {
            checkingAccount.withdraw(200);
            checkingAccount.withdraw(200);
            checkingAccount.withdraw(200);
            checkingAccount.withdraw(200);
        } catch (OverdraftException e) {
            //e.printStackTrace();
            System.out.println("具体原因： " + e.getMessage() + "透支超额： "+e.getDeficit());
        }
        System.out.println("余额为： "+ checkingAccount.getBalance());
    }
    public static void main(String[] args) {
        TestCheckingAccount testCheckingAccount = new TestCheckingAccount();
        testCheckingAccount.method01();
    }
}
